-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sdk-metrics-base): meter identity #2901
feat(sdk-metrics-base): meter identity #2901
Conversation
569a402
to
af786dd
Compare
Codecov Report
@@ Coverage Diff @@
## main #2901 +/- ##
==========================================
+ Coverage 92.48% 92.51% +0.03%
==========================================
Files 151 151
Lines 4841 4848 +7
Branches 1022 1024 +2
==========================================
+ Hits 4477 4485 +8
+ Misses 364 363 -1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
const meterCollectionPromises = Array.from(this._sharedState.meterSharedStates.values()) | ||
.map(meterSharedState => meterSharedState.collect(this, collectionTime)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random trivia: Array.from(states.values(), state => state.collect(this, collectionTime));
would be shorter, but benched it for fun and found that Array.from(states.values()).map(state => state.collect(this, collectionTime));
is ~4x faster on Node.js 🤷♂️
experimental/packages/opentelemetry-sdk-metrics-base/src/state/MeterProviderSharedState.ts
Outdated
Show resolved
Hide resolved
@dyladan updated, please take a look again :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but I think my second suggestion for changelog wording was actually more accurate than the first. The implementation looks fine to me though.
@dyladan now that the implementation does return the same meter object on identical input, the changelog entry should be fine I think? As the "shared internal state" is not exposed to end-users, I'd find your first suggestion is good though. |
I missed the |
thank you for reviewing :) |
Which problem is this PR solving?
As spec defines:
Also said:
So we need to not create a new MeterSharedState when a given name+version+schemaUrl pair is already created in the MeterProvider.
Fixes Partial #2593
Short description of the changes
Type of change
How Has This Been Tested?
Checklist: